import Http from '../http/http.js';
/**
 * 用户接口
 */
module.exports = {

	
	
	/**
	 * 用戶信息
	 */
	info(anonymous){
		return Http.get('/openapi/users/self', {anonymous:anonymous, ignore: anonymous})
	},
	/**
	 * 更新密碼
	 * @param {Object} oldPassword
	 * @param {Object} newPassword
	 */
	updatePwd(oldPassword, newPassword){
		return Http.put('/system/user/profile/updatePwd',{
			query:{
				oldPassword: oldPassword,
				newPassword: newPassword
			}
		})
	},
	/**
	 * 更新资料
	 * @param {Object} body
	 */
	updateProfile(body){
		return Http.put('/api/users',{
			body: body
		});
	},
	
	/**
	 * 获取用户信息
	 * @param {Object} userId
	 */
	getInfo(userId){
		return Http.get(`/system/user/${userId}/baseInfo`)
	},
	/**
	 * 学习数据
	 */
	learningData(){
		return Http.get('/api/learning/stats')
	}
	
	
};